package sample.Objects;

import java.util.Enumeration;
import java.util.Vector;

class Int {
	private int i;

	public Int(int ii) {
		this.i = ii;
	}

	public void increment() {
		i++;
	}

	public String toString() {
		return Integer.toString(i);
	}
}



public class Cloning {

	public static void main(String[] args) {
		Vector v = new Vector();
		for (int i = 0; i < 10; i++) {
			v.addElement(new Int(i));
		}
		System.out.println("V:" + v);

		Vector v2 = (Vector) v.clone();
		Enumeration e = v2.elements();
		while (e.hasMoreElements())
			((Int) e.nextElement()).increment();
		System.out.println("V2:" + v2);
		System.out.println("V :" + v);
	}

}
